home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: hearst.acc.Virginia.EDU!maxwell!gcl8a
- From: gcl8a@Virginia.EDU (Gregory Carl Lewin)
- Subject: Re: More ?'s re: copy ctor
- Message-ID: <DMn8B8.yJ@Virginia.EDU>
- Organization: University of Virginia
- References: <DMD0Kq.LHx@Virginia.EDU>
- Date: Mon, 12 Feb 1996 03:28:19 GMT
-
- oops! A syntax error in my note makes the question confusing.
- What I meant to say is:
-
- foo(Base2* b2) {...}
-
- will not except:
-
- Derived d;
- foo(&d);
-
- I get a "Cannot convert from type..." error. However, if foo
- is a member function of one of the classes, the error is not
- given:
-
- Base2::foo(Base2* b) {...}
- Derived::foo(Derived* d) {Base2::foo(d); ...} //OK!
-
- Further, an explicit cast prevents the error, but that seems
- odd-why shouldn't the comiler make the cast automatically?
-
- Greg Lewin
- .
-